<!--健康自评跳转页模块-->
<template class="div">
<!-- 头部 -->
        <div>
      <van-nav-bar
      title="健康自评"
      left-text="返回"
      right-text="历史记录"
      left-arrow
      @click-left="onClickLeft"
      @click-right="onClickright"
      fixed
         />
<!-- 健康自评卡 -->
<!-- 问答选项卡 -->

    <van-card
  class="card"
  :desc="item.s_title"
  :title="item.subtitle"
  :thumb="`http://www.zlllcy.com/image/icon-img/bg/${item.s_img}`"
  v-for="(item,i) in result" :key="i"
  :data-i="item.sid"
  @click="tomyself"
>
    </van-card>

    </div>
</template>

<style lang="scss" scoped  >
// 设置背景颜色
// 卡片样式
div[data-v-65bf3af6] .card:nth-child(2){
  margin-top: 46px !important;
}
.card{
  border: 1px solid rgb(214, 214, 214);
  width: 90%;
  margin: 10px auto;  
  border-radius: 10px 30px; 
}
@import '@/scss/public.scss';
  .van-card .van-card__content [data-v-65bf3af6]{
    /* border: 1px solid red; */
    margin-top: 10px;
  }
  
  .van-card .van-card__content .van-card__title{
    // 设置字体标题大小
    font-size: $fontSize16;
  }
 
</style>

<script>
import axios from 'axios'
export default {
    data() {
        return {
          result:''
        }
    },
    
  methods: {
    onClickLeft() {
      history.go(-1)
    },
    tomyself(e){
      // console.log(e.path[3])
      var i = e.path[4].dataset.i;
      // let i = document.ge
      this.$router.push(`/myself?id=${i}`);
    },
    onClickright(){
      this.$router.push('/history')
    }
  },
  mounted:function(){
             //自调用
             var __this = this;
            //  console.log(__this.name)
            
             axios.get('http://127.0.0.1:3000/assessment').then(res=>{
                //查找所有问题分类
                //  console.log(this)
               if(res.data.code===200){
                    // console.log(res);
                    __this.result = res.data.results
                    console.log(__this.result)
               }
             })
  }

}
</script>